package xyc.szk.eljstl.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@WebServlet(value="/jstl02")
public class Test02Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //int score=20;
        //获取浏览器传递过来的成绩 数据 --即浏览器的请求参数
       int score=Integer.parseInt(req.getParameter("score"));
        //将socre存放到request域中并将请求转发到页面jstl02.jsp
        req.setAttribute("score",score);
        req.getRequestDispatcher("/jstl02.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }
}
